{__NOLAYOUT__}
{include file='../public/header' /}
<link rel="stylesheet" type="text/css" href="__STATIC__/css/wangEditor.css">
<div class="container-fluid bg-white h-100 table-responsive ">
    <br>
    <div class="row">
        <form class="m-auto w-75" id="content" method="post" action="{$Request.root}/{$Request.controller}/add">
            <div class="form-group row">
                <label class="col-sm-2 col-form-label">所属分类</label>
                <div class="col-sm-10">
                    <div class="form-group">
                        <select class="custom-select select2bs4" name="category_id">
                            <option value="">无</option>
                            {volist name="categorylist" id="vo"}
                            <option value="{$vo.id}">{$vo.showName}</option>
                            {/volist}
                        </select>
                    </div>
                </div>
            </div>
            <div class="form-group row">
                <label class="col-sm-2 col-form-label">课程名称</label>
                <div class="col-sm-10">
                    <input type="text" class="form-control" name="title" placeholder="请输入课程名称">
                </div>
            </div>
            <div class="form-group row">
                <label class="col-sm-2 col-form-label">课程简介</label>
                <div class="col-sm-10">
                    <textarea class="form-control" rows="3" name="description" placeholder="请输入课程简介"></textarea>
                </div>
            </div>

            <div class="form-group row">
                <label class="col-sm-2 col-form-label">图片上传</label>
                <div class="col-sm-10">
                    <input id="img_upload" type="file" onchange="uploadImg('image_url','img_upload','preview_image','img_label')" accept="image/*" />
                    <input type="hidden" name="cource_image_url" id="image_url" value="">
                    <div id="preview_image">
                        <img src="">
                    </div>
                    <label for="img_upload" class="btn btn-warning btn-sm mt-2" id="img_label">图片上传
                    </label>
                        <small class="form-text text-muted mb-2">推荐900X400</small>

                </div>
            </div>

       
            <div class="form-group row">
                <label class="col-sm-2 col-form-label">是否收费</label>
                <div class="col-sm-10">
                    <div class="form-group clearfix">
                        <div class="icheck-success d-inline">
                            <input type="radio" name="sell_status" value="0" checked id="ismenu">
                            <label for="ismenu">
                                免费
                            </label>
                        </div>
                        <div class="icheck-success d-inline">
                            <input type="radio" name="sell_status" value="1" id="notmenu">
                            <label for="notmenu">
                                收费
                            </label>
                        </div>
                    </div>
                </div>
            </div>
            
            <div class="form-group row">
                <label class="col-sm-2 col-form-label">内容简介</label>
                <div class="col-sm-10">
                    <div id="editor">
                    </div>
                    <textarea id="editorcontent" class="display-none" name="content"></textarea>
                </div>
            </div>
            <div class="form-group row">
                <label class="col-sm-2 col-form-label">售卖价格</label>
                <div class="col-sm-10">
                    <input type="text" class="form-control" name="sell_price" placeholder="请输入售卖价格">
                </div>
            </div>
            <div class="form-group row">
                <label class="col-sm-2 col-form-label">课程难度</label>
                <div class="col-sm-10">
                    <div class="form-group clearfix">
                        <div class="icheck-success d-inline">
                            <input type="radio" name="level_status" value="1" id="level_primary">
                            <label for="level_primary">
                                初级
                            </label>
                        </div>
                        <div class="icheck-success d-inline">
                            <input type="radio" name="level_status" checked value="2" id="level_intermediate">
                            <label for="level_intermediate">
                                中级
                            </label>
                        </div>
                        <div class="icheck-success d-inline">
                            <input type="radio" name="level_status" value="3" id="level_senior">
                            <label for="level_senior">
                                高级
                            </label>
                        </div>
                    </div>
                </div>
            </div>
        <!--     <div class="form-group row">
                <label class="col-sm-2 col-form-label">课程标签</label>
                <div class="col-sm-10">
                    <input name="cource_tag" id="tagsinputval" class="tagsinput" data-role="tagsinput" value="demo" placeholder="输入后回车" />
                </div>
            </div> -->
            <div class="form-group row">
                <label class="col-sm-2 col-form-label">备注</label>
                <div class="col-sm-10">
                    <input type="text" class="form-control" name="remark" placeholder="请输入备注">
                </div>
            </div>
            <div class="form-group row">
                <label class="col-sm-2 col-form-label">显示</label>
                <div class="col-sm-10">
                    <div class="form-group">
                        <div class="icheck-success d-inline">
                            <input type="checkbox" name="show_status" checked value="1" id="showStatus">
                            <label for="showStatus">
                                是否可用
                            </label>
                        </div>
                    </div>
                </div>
            </div>
            <button class="sub-bindbtn" id="{:config('app.app_debug') ? 'debug':'nodebug'}" lay-submit lay-filter="bind">
            </button>
        </form>
    </div>
</div>
{include file='../public/script' /}
<!-- <script src="__STATIC__/js/tagsinput.js"></script> -->
<script src="__STATIC__/js/wangEditor.min.js"></script>
<script src="__ADMINSTATIC__/js/validate/courseValidate.js"></script>
<script type="text/javascript">
var E = window.wangEditor
var editor = new E('#editor')
var $text1 = $('#editorcontent')
editor.customConfig.onchange = function(html) {
    // 监控变化，同步更新到 textarea
    $text1.val(html)
}
editor.customConfig.menus = [
    'head',
    'bold',
    'italic',
    'foreColor',
    'backColor',
    'justify',
    'image',
    'video',
    'code',
    'underline'
]
editor.customConfig.uploadImgServer = '/admin/File/imageUpload'
editor.customConfig.uploadFileName = 'file[]'
wangeditor_debug_mode = 1
editor.create()
// 初始化 textarea 的值
$text1.val(editor.txt.html())
</script>